package ij.umasuo;

import ij.Prefs;
import ij.io.DirectoryChooser;
import ij.umasuo.camera.CameraCtrInterface;

import java.io.File;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;

/**
 * this class is used to save some constants value in memory
 * @author liuquan
 * @date 2013/08/06
 * @version 1.0
 *
 */
public class MyConstants {

	public static int LASER_MAX_POWER = 4500;
	public static int DELAY_EACH_PERIOD = 10;
	public static int ALGORITHM_ONLINE = 0;
	public static int ALGORITHM_OFFLINE = 1;//this model means the images we will process is loaded from the harddisk
	
	public static int DEFAULT_WIDTH = 512;//the default width of images
	public static int DEFAULT_HEIGHT = 512;//the default height of images
	public static Map<String,String> laserFH = new HashMap<String,String>();//the lasers' frequency
	public static Map<String,String> laserID = new HashMap<String,String>();//the lasers' ids in AOTF
	public static CameraCtrInterface cameraCtr = null;
	public static boolean isCanTakingDate = false; 
	static{
		laserFH.put("405", "153.7560");
		laserFH.put("459", "123.1750");
		laserFH.put("488", "113.7680");
		laserFH.put("532", "99.2574");
		laserFH.put("561", "93.6800");
		laserFH.put("656", "77.3082");
		
		laserID.put("405", "0");
		laserID.put("459", "1");
		laserID.put("488", "2");
		laserID.put("532", "3");
		laserID.put("561", "4");
		laserID.put("656", "5");
		
//		createWorkingPath();
//		getFileSavePath();
	}

	private static String fileSavePath = Prefs.getHomeDir() + "\\UImages\\";//here is the dir we save our file.
	
	public static int CENTER_OF_MASS = 1;
	public static int GAUSSIAN_FITTING = 2;
	public static int CUR_ALGORITHM = 2;// the default is gaussian
	
	public static boolean IS_3D = false;
	public static double PSF = 0;
	public static double PFA = 40;
	public static double PW = 160;
	
	/**
	 * here we auto create the working dir
	 */
	public static void createWorkingPath(){
		Calendar cal = Calendar.getInstance();
		String folderName = cal.get(Calendar.YEAR) + "." +(cal.get(Calendar.MONTH) + 1) + "." + cal.get(Calendar.DATE);
		fileSavePath = "D:\\" + folderName +"\\";
//		System.out.println(fileSavePath);
		File file = new File(fileSavePath);
		if (!file.exists()) {
			file.mkdirs();
		}
	}
	
	public static String getFileSavePath(){
		return fileSavePath;
	}
	public static void setFileSavePath(){
		DirectoryChooser chooser = new DirectoryChooser("Choose Working Directory");
		if (chooser.getDirectory() != null) {
			fileSavePath = chooser.getDirectory();
		}else{
			fileSavePath = Prefs.getHomeDir() + "\\UImages\\tmp\\";//here is the dir we save our file.
		}
	}
}
